const path = require("path");

function updateCompiler(compiler) {
  const options = compiler.options;

  options.entry.main.import.unshift(require.resolve("../../client/index.js"));

  options.entry.main.import.unshift(
    require.resolve("../../../webpack/hot/dev-server.js")
  );

  console.log(compiler.entry);
  // 把入口变更之后，通知 webpack 按照新的入口进行编译
  compiler.hooks.entryOption.call(options.context, options.entry);
}

module.exports = updateCompiler;
